﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MenuService
{
    internal class Menu
    {
        public Menu()
        {
            _items = new List<MenuItem>();
        }

        public MenuItem FindItemByKey(String itemKey)
        {
            MenuItem res = null;
            foreach(MenuItem item in _items)
            {
                res = item.FindItemByKey(itemKey);
                if (res != null)
                    return res;
            }
            return null;
        }

        private List<MenuItem> _items;

        public IEnumerable<MenuItem> Items
        {
            get { return _items; }
        }


        public void AddRootItem(MenuItem item)
        {
            _items.Add(item);
        }
    }
}
